#  makefile for LINUX OS
#  maliying 2010.10.28

C_FLAGS= -Wall -Wpointer-arith -O3 -pipe -g -D_REENTRANT -D_GUN_SOURCE -D__NET_LOG -D__DEBUG
SOURCES_FILES_CPP=$(wildcard *.cpp)
EXE_FILE=$(SOURCES_FILES_CPP:%.cpp=%)

BASE_SOURCE=$(wildcard ../src/*.cpp)
OBJ=$(BASE_SOURCE:../src/%.cpp=../obj/%.o)
OBJS=$(shell echo $(OBJ) | sed 's/..\/obj\/main.o//g')
INC=-I../src/
LIB=-lpthread
$(EXE_FILE):
	make -C ../src
	for E in $(EXE_FILE) ; \
          do \
            echo "$(CXX) -g -o2 -o ../bin/$$E $$E.cpp $(C_FLAGS) $(INC) $(OBJS) $(LIB)"; \
            $(CXX) -g -o2 -o ../bin/$$E $$E.cpp $(C_FLAGS) $(INC) $(OBJS) $(LIB);\
          done
all:$(EXE_FILE) 
	@echo "$(EXE_FILE)"
install:
	make -C ../src install
clean:
	for E in $(EXE_FILE) ; \
          do \
            echo "rm -f ../bin/$$E"; \
	    rm -f ../bin/$$E; \
	done
	rm -f ../obj/*.o
